updating oE gcd

Arithmetic

gcd

include math.e 
namespace math 
public function gcd(atom p, atom q) 

returns the greater common divisor of to atoms.

Parameters:
  1. p : one of the atoms to consider
  2. q : the other atom.
Returns:

A positive integer, which is the largest value that evenly divides into both parameters.

Comments:
  • Signs are ignored. Atoms are rounded down to integers.
  • If both parameters are zero, 0 is returned.
  • If one parameter is zero, the other parameter is returned.

Parameters and return value are atoms so as to take mathematical integers up to power(2,53).

Example 1:
? gcd(76.3, -114) --> 38 
? gcd(0, -114) --> 114 
? gcd(0, 0) --> 0 (This is often regarded as an error condition) 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu